package http

import (
	"fmt"
	"runtime"
	"time"

	"github.com/imroc/req/v3"
)

var m_client = req.C().
	SetCommonRetryCount(-1).
	SetCommonRetryBackoffInterval(1*time.Second, 5*time.Second).
	SetCommonRetryCondition(func(resp *req.Response, err error) bool {
		if err == nil {
			return false
		}
		req := resp.Request.RawRequest
		fmt.Println("Request:", req.Method, req.Host)
		runtime.Gosched()
		return true
	})

func Client() *req.Client {
	return m_client
}
